  import dayjs from 'dayjs'
  //传入指定日期时间返回该月的最早一天和最后一天时间戳
  function getTimeQuantum(dateTime) {
    console.log("6666");
    let startDate = dayjs(dateTime).format('YYYY-MM') + '-01 00:00:00';
    let endDate = dayjs(dateTime).add(1, 'month').format('YYYY-MM') + '-01 00:00:00';
    console.log(startDate);
    console.log(endDate);
    return [dayjs(startDate).valueOf(), dayjs(endDate).valueOf()];
  }

  //返回最近某个时间段的时间戳
  function nearestTimeQuantum(num,unit) {
    let startDate = dayjs();
    let endDate = dayjs().subtract(num, unit)
    return [dayjs(startDate).valueOf(), dayjs(endDate).valueOf()];
  }

  module.exports = {
    getTimeQuantum,
    nearestTimeQuantum
  }